import axios from '@/libs/api.request'

export class SysBasedataApi {
  static get (path, params = {}) {
    return request.get(path, createGETParams(params))
  }

  static post (path, params = {}) {
    return request.post(path, params)
  }

  // 根据条件获取基础数据
  static getList (params) {
    return axios.request({
      url: '/SysBasedata/GetList',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 根据类型条件获取基础数据(Value=编码)
  static getSelectValueList (params) {
    return axios.request({
      url: '/SysBasedata/GetSelectValueList',
      method: 'get',
      enctype: 'multipart/form-data',
      params: params
    })
  }

  // 根据类型条件获取基础数据(Value=主键)
  static getSelectIdList (params) {
    return axios.request({
      url: '/SysBasedata/GetSelectIdList',
      method: 'get',
      enctype: 'multipart/form-data',
      params: params
    })
  }

  // 根据ID获取基础数据
  static getModel (id) {
    return axios.request({
      url: '/SysBasedata/GetModel?parameter.id=' + id,
      method: 'get',
      enctype: 'multipart/form-data'
    })
  }

  // 保存基础数据
  static save (params) {
    return axios.request({
      url: '/SysBasedata/Save',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 启用/禁用基础数据
  static enabledList (params) {
    return axios.request({
      url: '/SysBasedata/EnabledList',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 基础数据类型改变事件返回结果
  static typeChange (params) {
    return axios.request({
      url: '/SysBasedata/TypeChange',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 基础数据父级改变事件返回结果
  static parentChange (params) {
    return axios.request({
      url: '/SysBasedata/ParentChange',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 向上\向下排序
  static updateOrderBy (params) {
    return axios.request({
      url: '/SysBasedata/UpdateOrderBy',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 根据基础数据ID更新是否默认【IsDefault】
  static updateDefault (params) {
    return axios.request({
      url: '/SysBasedata/UpdateDefault',
      method: 'post',
      enctype: 'multipart/form-data',
      data: params
    })
  }

  // 离职原因下拉数据源
  static getLeaveReasonList (params) {
    return axios.request({
      url: '/SysBasedata/GetSelectIdList',
      method: 'get',
      enctype: 'multipart/form-data',
      params: params
    })
  }
}
